<template>
  <div class="flex-al box">
    <build-el-h1 name="chaxun.png" type="2"></build-el-h1>
    <el-input
      placeholder="请输入姓名"
      v-model="certificateSearch.number"
      size="medium"
      width="20px"
      clearable
      style="width:211px;margin-bottom:20px"
    ></el-input>
    <el-input
      placeholder="请输入档案编号"
      v-model="certificateSearch.licensee"
      size="medium"
      width="20px"
      clearable
      style="width:211px;margin-bottom:20px"
    ></el-input>
    <!-- <p class="warn-p" v-if="dataObj&&!dataObj.data">{{dataObj.content}}</p>
    <p class="success-p" v-if="dataObj&&dataObj.data">恭喜您，获奖有效！</p>-->

    <el-button
      type="primary"
      style="width:211px;margin-bottom:30px"
      @click="chaxun"
      >查询</el-button
    >
  </div>
</template>
<script>
import buildElH1 from '../build-el-h1';
export default {
  components: {
    buildElH1,
  },
  data() {
    return {
      name: '',
      code: '',
      dataObj: null,
      certificateSearch: {
        number: '',
        licensee: '',
      },
    };
  },
  methods: {
    async chaxun() {
      if (this.certificateSearch.number == '') {
        this.$message({
          message: '姓名不能为空',
        });
        return;
      }

      if (this.certificateSearch.licensee == '') {
        this.$message({
          message: '编号不能为空',
        });
        return;
      }
      const reg = /^[A-Za-z0-9]+$/;

      if (!reg.test(this.certificateSearch.licensee)) {
        this.$message({
          message: '编号只能输入数字和字母!',
        });
        return;
      }

      this.$router.push({
        name: 'bookSearch',
        query: {
          ...this.certificateSearch,
        },
      });
      // let dataObj = await this.api.verification(this.code, this.name)
      // this.dataObj = dataObj
    },
  },
};
</script>
<style lang="less" scoped>
.box {
  width: calc(1200px - 875px);
  .warn-p {
    font-size: 14px;
    color: #bf1425;
    margin-bottom: 20px;
  }
  .success-p {
    font-size: 14px;
    color: green;
    margin-bottom: 20px;
  }
}
</style>
